import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:toolbox/common/strings.dart';

Widget defaultDialog({
  String? title,
  String? content,
  String? sure,
  String? cancel,
  Function? sureFunction,
  Function? cancelFunction,
  bool noAction = false,
}) {
  return AlertDialog(
    title: Text(title ?? Strings.tip),
    content: SingleChildScrollView(
      child: SelectableText(
        content ?? Strings.tip,
        scrollPhysics: const NeverScrollableScrollPhysics(),
      ),
    ),
    actions: noAction
        ? []
        : [
            TextButton(
              onPressed: () {
                cancelFunction?.call();
                Get.back();
              },
              child: Text(cancel ?? Strings.cancel),
            ),
            TextButton(
              onPressed: () {
                sureFunction?.call();
                Get.back();
              },
              child: Text(sure ?? Strings.sure),
            ),
          ],
  );
}
